package com.lzw.mall.common.mapper;

import com.lzw.mall.common.entity.Product;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author lizhenwei
 * @since 2023-03-22
 */
public interface ProductMapper extends BaseMapper<Product> {

    List<Product> selectListPage(String keyword,String status);

    void doUp(Integer[] ids);

    void doDown(Integer[] ids);

    @Update("update product set del=1 where id=#{id}")
    void doDelete(Integer id);

    @Select("select * from product where category_id=#{id} and status='已上架' order by price limit 0,1" )
    Product cheap(Integer id);
}
